﻿<Window x:Class="EmployeeModule.EmployeeChooser.EmployeeChooserView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:lchooser="clr-namespace:EmployeeModule.EmployeeChooser"
        Width="400" Height="300"
        >
    
    <DockPanel>
        <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
            <Label Margin="5">Lastname begins with:</Label>
            <TextBox Margin="5" Name="lastnameTB" Width="80" />
            <Button Margin="5" IsDefault="True" Command="{x:Static lchooser:EmployeeChooserCommands.GetEmployeesByLastNameCommand}"
                    CommandParameter="{Binding ElementName=lastnameTB, Path=Text}">Get Employees</Button>
        </StackPanel>
        
        <ListView DockPanel.Dock="Top" ItemsSource="{Binding Path=Employees}" SelectedItem="{Binding Path=SelectedEmployee}" >
            <ListView.Resources>
                <Style TargetType="ListViewItem">
                    <EventSetter Event="MouseDoubleClick" Handler="HandleGridRowDoubleClick" />
                </Style>
            </ListView.Resources>
            <ListView.View>
                <GridView>
                    <GridViewColumn DisplayMemberBinding="{Binding Firstname}" Header="Firstname" />
                    <GridViewColumn DisplayMemberBinding="{Binding Lastname}" Header="Lastname" />
                    <GridViewColumn DisplayMemberBinding="{Binding PersonID}" Header="ID" />
                </GridView>
            </ListView.View>
        </ListView>
        
        <Label DockPanel.Dock="Bottom">Double click a row to choose</Label>
        
    </DockPanel>
</Window>
